﻿using System;

namespace LeanBoard.Models
{
    [Serializable]
    public class Item
    {
        public string Id{get;set;}
        public string Status { get; set; }
        public string DevResponsible { get; set; }
        public string QaResponsible { get; set; }
        public string Title { get; set; }
        public string Type { get; set; }
        public string ItemType { get; set; }
        public string Unid { get; set; }
        public int Priority { get; set; }
        public string Team { get; set; }
        public int Progress { get; set; }
        public string Sb { get; set; }
        public string Release { get; set; }

        public string PriorityString
        {
            get { return Priority == int.MaxValue ? "n/a" : Priority.ToString(); }
        }

        public string CurrentlyResponsible
        {
            get
            {
                if (Status == DominoStatuses.TestingStatusKey || Status == DominoStatuses.DoneStatusKey)
                    if(Sb != "Failed")
                    return QaResponsible;

                return Type == "PR" ? QaResponsible : DevResponsible;
            }
        }
    }
}